package offer;

public class offer21 {
}
class Solution21 {
    public  static int[] exchange(int[] nums) {
        int start = 0 ;
        int end = nums.length-1;
        while (start<end)
        {
            while (nums[start]%2!=0)
            {
                start++;
            }
            while (nums[end]%2==0)
            {
                end--;
            }
            if(start<end) {
                int temp = nums[start];
                nums[start] = nums[end];
                nums[end] = temp;
            }
//            start++;
//            end--;
        }
     return  nums;
    }

    public static void main(String[] args) {
        int [] nums = {1,3,5};
        int[] exchange = exchange(nums);
        System.out.println(exchange);
    }
}